/*
 * @FilePath: \bridge_web\src\store\modules\user.js
 * @Author: bsj
 * @Date: 2023-06-14 09:47:05
 * @LastEditTime: 2024-04-07
 * @LastEditors: baoshijie
 * @Description: 
 */
import { login, logout, getInfo, refreshToken } from '@/api/login'
import { getToken, setToken, setExpiresIn, removeToken } from '@/utils/auth'
import defAva from '@/assets/images/profile.jpg'

const user = {
  state: {
    token: getToken(),
    name: '',
    userId: '',
    avatar: '',
    roles: [],
    permissions: [],
    tenantId:'',
    compCode:''

  },

  mutations: {
    SET_TOKEN: (state, token) => {
      state.token = token
    },
    SET_EXPIRES_IN: (state, time) => {
      state.expires_in = time
    },
    SET_NAME: (state, name) => {
      state.name = name
    },
    SET_USERID: (state, userId) => {
      state.userId = userId
    },
    SET_AVATAR: (state, avatar) => {
      state.avatar = avatar
    },
    SET_ROLES: (state, roles) => {
      state.roles = roles
    },
    SET_PERMISSIONS: (state, permissions) => {
      state.permissions = permissions
    },
    SET_TENANTID: (state, tenantId) => {
      state.tenantId = tenantId
    },
    SET_COMPCODE: (state, code) => {
      console.log("🚀 ~ code:", code)
      state.compCode = code
    },
  },

  actions: {

  }
}

export default user
